package flc.ast.adapter;

import static android.view.View.GONE;

import android.widget.ImageView;

import androidx.annotation.NonNull;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.provider.BaseItemProvider;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import flc.ast.R;
import stark.common.basic.adaptermutil.StkProviderMultiAdapter;
import stark.common.basic.adaptermutil.StkSingleSpanProvider;

public class RecordPictureAdapter extends StkProviderMultiAdapter<String> {

    public RecordPictureAdapter() {
        addItemProvider(new StkSingleSpanProvider<>(100));
        addItemProvider(new RecordPictureProvider());
    }

    private class RecordPictureProvider extends BaseItemProvider<String> {
        @Override
        public int getItemViewType() {
            return StkProviderMultiAdapter.TYPE_VIEW;
        }

        @Override
        public int getLayoutId() {
            return R.layout.item_sel_picture;
        }

        @Override
        public void convert(@NonNull BaseViewHolder baseViewHolder, String bean) {
            Glide.with(getContext()).load(bean).into((ImageView) baseViewHolder.getView(R.id.ivSelPictureItemImg));
            baseViewHolder.getView(R.id.ivSelPictureItemSel).setVisibility(GONE);
            baseViewHolder.getView(R.id.llSelPictureItemSel).setVisibility(GONE);
        }
    }
}
